<template>
  <div class="table-page-search-wrapper">
    <a-form layout="inline">
      <a-row>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="总订单号:">
            <a-input allowClear v-model="searchForm.payOrderNo" placeholder="请输入总订单号" />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="订单编号:">
            <a-input allowClear v-model="searchForm.subOrderId" placeholder="请输入订单编号" />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="联系电话:">
            <a-input allowClear v-model="searchForm.phone" placeholder="请输入联系电话" />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="订单状态:">
            <a-select v-model="searchForm.orderStatus" placeholder="请选择订单状态" allowClear>
              <a-select-option v-for="item in statuslistt" :key="item.value" :value="item.value">{{
                item.label
              }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="创建时间:">
            <a-range-picker
              @change="cxsjChange"
              style="width: 100%"
              v-model="time"
              
              show-time
              format="YYYY-MM-DD HH:mm:ss"
            >
              <a-icon slot="suffixIcon" type="smile" />
            </a-range-picker>
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="订单来源:">
            <a-select v-model="searchForm.orderSource" placeholder="请选择订单来源" allowClear>
              <a-select-option v-for="item in laiyuanList" :key="item.value" :value="item.value">{{
                item.label
              }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item label="工单状态:">
            <a-select v-model="searchForm.workStatus" placeholder="请选择工单状态" allowClear>
              <a-select-option v-for="item in gdList" :key="item.value" :value="item.value">{{
                item.label
              }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="12" :xs="24" style="padding: 0 8px">
          <a-form-item>
            <a-button type="primary" icon="search" @click="searchAction()">查找</a-button>
            <a-button icon="delete" @click="resetSearch()" style="margin-left: 8px">重置</a-button>
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
  </div>
</template>
<script>
import moment from 'moment'
export default {
  name: 'search',
  props: ['keyName'],
  data() {
    return {
      statuslistt: [
        {
          label: '支付成功',
          value: '00',
        },
        {
          label: '支付失败',
          value: '01',
        },
        {
          label: '待支付',
          value: '02',
        },
        {
          label: '支付中',
          value: '03',
        },
        {
          label: '作废',
          value: '04',
        },
      ], //订单状态
      laiyuanList: [
        {
          label: '全部',
          value: '',
        },
        {
          label: '线下',
          value: '02',
        },
        {
          label: 'APP',
          value: '01',
        },
        {
          label: '小程序',
          value: '00',
        },
      ], //订单来源
      gdList: [
        {
          label: '待派单',
          value: '00',
        },
        {
          label: '待服务',
          value: '01',
        },
        {
          label: '服务中',
          value: '02',
        },
        {
          label: '已完成',
          value: '03',
        },
        {
          label: '退款审核',
          value: '04',
        },
        {
          label: '退款关闭',
          value: '05',
        },
        {
          label: '待接单',
          value: '06',
        },
      ],
      searchForm: {},
      time: [],
    }
  },
  methods: {
    moment,
    searchAction() {
      //执行搜索
      this.$emit('search')
    },
    resetSearch() {
      this.searchForm = {}
      this.time = []
      this.$emit('resetSearch')
    },
    getSearchForm() {
      //获取高级搜索条件
      return {
        ...this.searchForm,
      }
    },
    cxsjChange(e) {
      console.log('cxsjChange', e)
      if(e.length == 0) return false
      this.searchForm.startTime = this.formDate(e[0]._d)
      this.searchForm.endTime = this.formDate(e[1]._d)
      console.log('cxsjChange', this.searchForm)
    },
  },
}
</script>


<style lang="less">
</style>>
